
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import com.encrypt.classloader.MainDecryptClassLoader;

/**
 * 密钥型类加载器启动类
 * 
 * @author yiyongpeng
 * 
 */
public class Decrypt {
	public static void main(String[] args) throws Throwable {
		String classpath = System.getProperty("cl.class.path");
		if (classpath == null)
			classpath = System.getenv("CL_CLASSPATH");
		ClassLoader cl = new MainDecryptClassLoader(classpath);
		Thread.currentThread().setContextClassLoader(cl);
		Class<?> startup = cl.loadClass(args[0]);
		String[] args0 = new String[args.length - 1];
		for (int i = 1; i < args.length; i++)
			args0[i - 1] = args[i];
		Method main = startup.getMethod("main", String[].class);
		try {
			main.invoke(null, (Object) args0);
		} catch (InvocationTargetException e) {
			throw e.getCause();
		}
	}
}
